<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/base/unit.html">

<script>
  'use strict';
  Polymer({
    is: 'tr-v-ui-preferred-display-unit',

    ready() {
      this.preferredTimeDisplayMode_ = undefined;
    },

    attached() {
      tr.b.Unit.didPreferredTimeDisplayUnitChange();
    },

    detached() {
      tr.b.Unit.didPreferredTimeDisplayUnitChange();
    },

    // null means no-preference
    get preferredTimeDisplayMode() {
      return this.preferredTimeDisplayMode_;
    },

    set preferredTimeDisplayMode(v) {
      if (this.preferredTimeDisplayMode_ === v) return;
      this.preferredTimeDisplayMode_ = v;
      tr.b.Unit.didPreferredTimeDisplayUnitChange();
    }

  });
</script>
